home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / ohlutil.zip / CP.H < prev    next >
C/C++ Source or Header  |  1990-06-14  |  3KB  |  123 lines

  1. /*  cp.h  -- file copying (data definitions)
  2.     Copyright (C) 1989, 1990 Free Software Foundation.
  3.  
  4.     This program is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU General Public License as published by
  6.     the Free Software Foundation; either version 1, or (at your option)
  7.     any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program; if not, write to the Free Software
  16.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.     Written by Torbjorn Granlund, Sweden (tege@sics.se). */
  19.  
  20. #include <sys/types.h>
  21.  
  22. #include "system.h"
  23.  
  24. struct dir_list
  25. {
  26.   struct dir_list *parent;
  27.   ino_t ino;
  28.   dev_t dev;
  29. };
  30.  
  31. struct entry
  32. {
  33.   ino_t ino;
  34.   dev_t dev;
  35.   char *node;            /* Path name, or &new_file for new inodes.  */
  36.   struct entry *coll_link;    /* 0 = entry not occupied.  */
  37. };
  38.  
  39. struct htab
  40. {
  41.   unsigned modulus;        /* Size of the `hash' pointer vector.  */
  42.   struct entry *entry_tab;    /* Pointer to dynamically growing vector.  */
  43.   unsigned entry_tab_size;    /* Size of current `entry_tab' allocation.  */
  44.   unsigned first_free_entry;    /* Index in `entry_tab'.  */
  45.   struct entry *hash[1];    /* Vector of pointers in `entry_tab'.  */
  46. };
  47.  
  48. extern int exit_status;
  49. extern struct htab *htab;
  50.  
  51. extern char *xmalloc ();
  52. extern char *xrealloc ();
  53. extern void forget_copied ();
  54. extern void forget_all ();
  55. extern int copy_reg ();
  56. extern void hash_init ();
  57. extern char *remember_copied ();
  58. extern int remember_created ();
  59.  
  60. /* For created inodes, a pointer in the search structure to this
  61.    character identifies that the inode as new.  */
  62. extern char new_file;
  63.  
  64. extern void error ();
  65. extern void usage ();
  66. extern char *savedir ();
  67. extern char *str_cpy ();
  68. extern int yesno ();
  69. extern int do_copy ();
  70. extern int copy ();
  71. extern int copy_dir ();
  72. extern void strip_trailing_slashes ();
  73. extern int is_ancestor ();
  74.  
  75. /* System calls.  */
  76. extern int mknod ();
  77.  
  78. #ifdef _POSIX_SOURCE
  79. #define S_IWRITE S_IWUSR
  80. #define S_IEXEC S_IXUSR
  81. #else
  82. extern int open ();
  83. extern int close ();
  84. extern int fstat ();
  85. extern int stat ();
  86. extern int lstat ();
  87. extern int read ();
  88. extern int write ();
  89. extern int symlink ();
  90. extern int readlink ();
  91. extern int mkdir ();
  92. #if 0                /* Breaks on SunOS 4.1. */
  93. extern int umask ();
  94. #endif
  95. extern int unlink ();
  96. extern int link ();
  97. extern int chmod ();
  98. extern int chown ();
  99. extern int fchmod ();
  100. extern int access ();
  101. extern int utime ();
  102. extern int ftruncate ();
  103. extern int isatty ();
  104. extern off_t lseek ();
  105. #endif
  106.  
  107. /* Library calls.  */
  108. #include <errno.h>
  109. #ifdef STDC_HEADERS
  110. #include <stdlib.h>
  111. #else
  112. extern char *getenv ();
  113. extern char *malloc ();
  114. extern char *realloc ();
  115. extern int free ();
  116. extern void exit ();
  117. extern int fprintf ();
  118. extern int fputs ();
  119. extern int printf ();
  120.  
  121. extern int errno;
  122. #endif
  123.